package com.newcapec.modules.health.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.newcapec.common.utils.PageUtils;
import com.newcapec.common.utils.Query;

import com.newcapec.modules.health.dao.HealthRecordDao;
import com.newcapec.modules.health.entity.HealthRecordEntity;
import com.newcapec.modules.health.service.HealthRecordService;


@Service("healthRecordService")
public class HealthRecordServiceImpl extends ServiceImpl<HealthRecordDao, HealthRecordEntity> implements HealthRecordService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String name = (String)params.get("name");
        String stuNo = (String)params.get("stuNo");
        String deptName = (String)params.get("deptName");
        String unpuch = (String)params.get("unpuch");
        String aggregates = (String)params.get("aggregates");
        String health = (String)params.get("health");
        String exception = (String)params.get("exception");
        IPage<HealthRecordEntity> page = this.page(
                new Query<HealthRecordEntity>().getPage(params),
                new QueryWrapper<HealthRecordEntity>()
                        .like(StringUtils.isNotBlank(name),"name",name)
                        .eq(StringUtils.isNotBlank(stuNo),"stu_no",stuNo)
                        .like(StringUtils.isNotBlank(deptName),"dept_name",deptName)
                        .gt(StringUtils.isNotBlank(unpuch),"unpuch",unpuch)
                        .gt(StringUtils.isNotBlank(aggregates),"aggregates",aggregates)
                        .gt(StringUtils.isNotBlank(health),"health",health)
                        .gt(StringUtils.isNotBlank(exception),"exception",exception)


        );

        return new PageUtils(page);
    }

}